# URL中?后的参数会被自动识别为查询参数
from fastapi import FastAPI
import uvicorn

app = FastAPI()
@app.get("/items/")
async def read_item(skip: int = 0, limit: int = 10):    # 有默认值的可选参数
    return {"skip": skip, "limit": limit}

if __name__ == '__main__':
    uvicorn.run(app, host='127.0.0.1', port=8000)
# 访问：http://127.0.0.1:8000/items/?skip=1&limit=5
